<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use app\models\DorminfoModel;
use yii\data\ActiveDataProvider;
use yii\grid\GridView;
use app\models\Dormchangeinfo;

/* @var $this yii\web\View */
/* @var $model app\models\DorminfoModel */

$this->title = '住宿信息';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="dorminfo-model-view">
 <h4>住宿信息</h4>      					
 <?php   $dataProvider = new ActiveDataProvider([
            'query' => DorminfoModel::find()->where(['stu_id'=>$id]),
        ]); 
?>					
<?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            'stu_id',
            'dorm_area'=>[
            		'attribute'=>'dorm_area',
            	'value'=>function($model){
					if($model->dorm_area==0) return "东校区";
					if($model->dorm_area==1) return "西校园";
					if($model->dorm_area==2) return "西校园南区";
				}
			],
            'dormitory',
            'dorm_num',        
            'leader',
            	
				
        ],
]); ?> 

<h4>宿舍变动信息</h4> 
<?php   $dataProvider = new ActiveDataProvider([
            'query' => Dormchangeinfo::find()->where(['stu_id'=>$id]),
        ]); 
?>					
<?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            'stu_id',
            'stu_name',
        	'time',
        	'type',
        	'before_num',
        	'before_floor',
        	'after_num',
        	'after_floor',
        	'remark',				
        ],
]); ?> 
</div>
